#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;
int n;
int h[N], res[N];
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)cin >> h[i];
    
    vector<int> s(n + 10);
    int cnt = 0;
    s[0] = 0;
    for (int i = n; i >= 1; i--){
        while (cnt && h[s[cnt]] <= h[i])cnt--;
        res[i] = s[cnt];
        s[++cnt] = i;
    }
    for (int i = 1; i <= n; i++)
        cout << res[i] << "\n";

    return 0;
}
